← Back
Editing: index299.js
import{s as e,j as a,r as s,k as t,U as l,e as o,c as r,G as n,q as p,v as i,A as u,y as d,J as c,x as m,H as f,I as w,aX as v,aa as y,D as b,a8 as g}from"./base-lib.js?v=1765440387";import{w as _,A as h,o as x,K as F,M as C,$ as T,k,_ as j,e as P}from"./utils-lib.js?v=1765440387";import{_ as I}from"./index91.js?v=1765440387";import{u as A,L}from"./useStore7.js?v=1765440387";import{h as R,i as V,o as q}from"./validator.js?v=1765440387";import"./__commonjsHelpers__.js?v=1765440387";import"./column.js?v=1765440387";import"./index94.js?v=1765440387";const B=a("FTP-BATCH-EDIT-PAW",()=>({updateFtpInfoRef:s(),ftpForm:t({type:"0",password:_(12)}),typeOptions:s([{label:"所有密码一致",value:"0"},{label:"所有密码不一致",value:"1"}])})),D=()=>e(B()),{rowData:S,isRefreshFtpList:E}=A(),{ftpForm:H,updateFtpInfoRef:O}=D(),U=t({password:[{validator:(e,a,s)=>{a.length>=6||"0"!==H.value.type?s():s(new Error("FTP密码长度不能少于6位!"))},trigger:["blur"]}]}),W=()=>{H.value.password=_(12)},J=()=>{h({value:H.value.password})},G=()=>{var e;S.value.selectedList.length>0&&h({value:null==(e=S.value.selectedList.map(e=>"".concat(e.name,"--").concat(e.password)))?void 0:e.join("\n")})},K=()=>{S.value.selectedList.forEach(e=>{e.password=_(12)});const e=document.querySelector(".refreshAllBtn");null==e||e.blur()},M=()=>{const e=S.value.selectedList.map(e=>({id:e.id,ftp_username:e.name,new_password:"0"==H.value.type?H.value.password:e.password}));return{ftp_list:JSON.stringify(e)}},N=async e=>{try{await O.value.validate(),await x({title:"提示",width:"35rem",content:"修改FTP密码后,旧密码将无法登录FTP账号,是否继续操作?"});const{config:a}=S.value,{enable:s,exclude:t}=a,l=R(!1,t,s,{params:M()}),o=await F({loading:"正在修改FTP密码,请稍候...",request:L(l),data:Array});let{data:r}=V(o);r=r.map(e=>({...e,name:e.ftp_username})),q(r,{title:"修改FTP密码"}),S.value.clearSelection(),E.value=!0,e&&e()}catch(a){}},X=l([{label:"用户名",prop:"name",fixed:!0,minWidth:100},{label:"密码",fixed:!0,minWidth:200,isCustom:!0,render:e=>{const a={lt:"<",gt:">",nbsp:" ",amp:"&",quot:'"'};return e.password=e.password.replace(/&(lt|gt|nbsp|amp|quot);/gi,function(e,s){return a[s]}),o("input",{type:"text",value:e.password,class:"bt-table-input !w-[18rem]",placeholder:"点击编辑密码",title:"点击编辑密码",onBlur:a=>{if(a.target.value.length<6&&(C.error("FTP密码长度不能少于6位!"),a.target.value=e.password),e.password===a.target.value)return!1;e.password=a.target.value}},null)}}]),$={class:"mt-[1.6rem] flex"},z=P(r({__name:"index",setup(e,{expose:a}){const{rowData:s}=A(),{ftpForm:t,typeOptions:l,updateFtpInfoRef:r}=D();return a({onConfirm:N}),(e,a)=>{const _=v,h=T,x=y,F=k,C=b,P=I,A=j,L=g,R=n("bt-loading");return p(),i("div",{class:c("1"==m(t).type?"pt-2rem pr-2rem":"p-2rem")},[o(_,{class:c(["!w-full","1"==m(t).type?"warn":""]),icon:"svgtofont-el-warning",type:"warning",closable:!1},{title:u(()=>[...a[2]||(a[2]=[d("span",null,"批量改密已选FTP用户,默认自动化改密,支持自定义",-1)])]),_:1},8,["class"]),o(L,{ref_key:"updateFtpInfoRef",ref:r,rules:m(U),model:m(t),class:"bt-custom-form"},{default:u(()=>[o(x,{label:"类型",class:"typeClass"},{default:u(()=>[o(h,{type:"button",class:"!flex",modelValue:m(t).type,"onUpdate:modelValue":a[0]||(a[0]=e=>m(t).type=e),options:m(l)},null,8,["modelValue","options"])]),_:1}),f(o(x,{label:" ",class:"typeClass"},{default:u(()=>[f(o(F,{"max-height":200,ref:"showFtpTableRef",column:m(X),data:m(s).selectedList,description:"FTP列表为空"},null,8,["column","data"]),[[R,"正在加载FTP列表,请稍后...","title"]]),d("div",$,[o(C,{type:"default",onClick:m(G),class:"inline-block flex items-center"},{default:u(()=>[...a[3]||(a[3]=[d("i",{class:"svgtofont-icon-copy"},null,-1),d("span",{class:"mb-[2px] ml-[4px]"},"复制所有",-1)])]),_:1},8,["onClick"]),o(C,{type:"default",onClick:m(K),class:"refreshAllBtn"},{default:u(()=>[...a[4]||(a[4]=[d("i",{class:"svgtofont-el-refresh"},null,-1),d("span",{class:"mb-[2px] ml-[4px]"},"刷新所有",-1)])]),_:1},8,["onClick"])])]),_:1},512),[[w,"1"===m(t).type]]),f(o(x,{label:"密码",class:"relative mt-[16px] typeClass",prop:"password"},{default:u(()=>[o(P,{modelValue:m(t).password,"onUpdate:modelValue":a[1]||(a[1]=e=>m(t).password=e),style:{width:"26rem"},name:"password",icon:"el-refresh",onIconClick:m(W)},null,8,["modelValue","onIconClick"]),o(A,{icon:"icon-copy",class:"w-1.8rem h-1.8rem cursor-pointer absolute top-0 right-16",onClick:m(J)},null,8,["onClick"])]),_:1},512),[[w,"0"==m(t).type]])]),_:1},8,["rules","model"])],2)}}}),[["__scopeId","data-v-78d50617"]]);export{z as default};
Save File
Cancel